import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { QualityAcceptanceVO, QualityAcceptanceForm, QualityAcceptanceQuery } from '@/pagesA/api/workflow/qualityAcceptance/types';

/**
 * 查询质保验收单列表
 * @param query
 * @returns {*}
 */

export const listQualityAcceptance = (query?: QualityAcceptanceQuery): AxiosPromise<QualityAcceptanceVO[]> => {
  return request({
    url: '/workflow/qualityAcceptance/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询质保验收单详细
 * @param id
 */
export const getQualityAcceptance = (id: string | number): AxiosPromise<QualityAcceptanceVO> => {
  return request({
    url: '/workflow/qualityAcceptance/' + id,
    method: 'get'
  });
};

/**
 * 新增质保验收单
 * @param data
 */
export const addQualityAcceptance = (data: QualityAcceptanceForm) => {
  return request({
    url: '/workflow/qualityAcceptance',
    method: 'post',
    data: data
  });
};

/**
 * 修改质保验收单
 * @param data
 */
export const updateQualityAcceptance = (data: QualityAcceptanceForm) => {
  return request({
    url: '/workflow/qualityAcceptance',
    method: 'put',
    data: data
  });
};

/**
 * 删除质保验收单
 * @param id
 */
export const delQualityAcceptance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/qualityAcceptance/' + id,
    method: 'delete'
  });
};
